import request from '@/utils/request'

// 查询校内活动列表
export function listActivity(query) {
  return request({
    url: '/campus/activity/list',
    method: 'get',
    params: query
  })
}

// 查询校内活动详细
export function getActivity(id) {
  return request({
    url: '/campus/activity/' + id,
    method: 'get'
  })
}

// 新增校内活动
export function addActivity(data) {
  return request({
    url: '/campus/activity',
    method: 'post',
    data: data
  })
}

// 修改校内活动
export function updateActivity(data) {
  return request({
    url: '/campus/activity',
    method: 'put',
    data: data
  })
}

// 删除校内活动
export function delActivity(id) {
  return request({
    url: '/campus/activity/' + id,
    method: 'delete'
  })
}

// 取消校内活动
export function cancelActivity(id) {
  return request({
    url: '/campus/activity/cancel/' + id,
    method: 'put'
  })
}

// 发布校内活动
export function publishActivity(id) {
  return request({
    url: '/campus/activity/publish/' + id,
    method: 'put'
  })
}

// 报名参加活动
export function signUpActivity(activityId) {
  return request({
    url: '/campus/activity/signUp',
    method: 'post',
    data: { activityId }
  })
}